<?php 

include_once dirname(__FILE__) . "/user.php";

if(empty($_GET['url']))
{
    include_once dirname(__FILE__) .  "/shizhong.php";
    die();
}

if(!empty(REFERER_URL))
{
    @$referer = $_SERVER['HTTP_REFERER'] ? $_SERVER['HTTP_REFERER'] : base64_decode($_POST['referer']);
    $refererhost = parse_url($referer, PHP_URL_HOST);
    if(!in_array(strtolower($refererhost),explode("|", strtolower(REFERER_URL))))
    {
        header('HTTP/1.1 403 Forbidden');
        exit(ERROR);
    }
}

$player = $_GET['player'];

?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"/> 
<meta name="renderer" content="webkit"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo empty($user['title']) ? '智能解析系统' : $user['title'];?></title>
<style type="text/css">body,html,.content{background-color:black;padding: 0;margin: 0;width:100%;height:100%;color:#999;}.divs{width:100%;height:auto;position:fixed;left:0;top:0;z-index:999}</style>
<script type="text/javascript" src="./jquery.min.js"></script>

<script type="text/javascript">if("<?=$user['domain'];?>"!=''){if (document.domain != '<?=$user['domain'];?>'){window.location.href='<?=$user['tiaodomain'];?>';}}</script>

</head>
<body style="overflow-y:hidden;">
<div id="loading" align="center">
<div style="padding-top:20%;width:100%;height:100%"><span class="tips">正在加载中，请稍候... <font class="timemsg">0</font> 秒</span></div><span class="timeout" style="display:none;color:#f90;">服务器响应超时，请刷新重试！</span></div>
<input type="hidden" id="k1" value='<?= time(); ?>'/>
<div id="a1" class="content" style="display:none;width:100%;height:100%" align="center"></div>
<div id="error" class="content" style="display:none;color:#f90;padding-top:20%;width='100%';height='100%" align="center"></div>
<script type="text/javascript">
function tipstime(count)
{
    $('.timemsg').text(count);
    if (count == 20)
    {
       $('.tips').hide();
       $('.timeout').show();
    }
    else
    {
        count += 1;
        setTimeout(function () {
            tipstime(count);
        }, 1000);
    }
}
tipstime(0);

	var url="<?php echo $_GET["url"]; ?>";
 var h5=<?php echo intval($user['h5']); ?>;
 var autoplay=<?php echo intval($user['autoplay']); ?>;
var danmuplay=<?php echo intval($user['danmuplay']); ?>;
    player = 'dplayer';
	var isMobile = navigator.userAgent.match(/iPad|iPhone|Android|Linux|iPod/i)!=null;
	var autoplay = isMobile ? h5 :autoplay ;

	$.get("./api.php",{'url':url},function(data){
	
	if(data.code=="0")
	{
	var frameurl = "./dp.php?data=" + data.data  + "&autoplay=" + autoplay + "&dplayermenu=" + '<?php echo $user['dplayer'];?>'; 
			$("#a1").html('<iframe width="100%" height="100%" src="'+frameurl+'" frameborder="0" border="0" marginwidth="0" marginheight="0" scrolling="no" allowfullscreen="allowfullscreen" mozallowfullscreen="mozallowfullscreen" msallowfullscreen="msallowfullscreen" oallowfullscreen="oallowfullscreen" webkitallowfullscreen="webkitallowfullscreen" style="position: relative;z-index: 9999999;"></iframe>');
			$("#error").hide();
			$("#loading").hide();
			$("#a1").show();
		

	}
	else
	{
		<?php if($user['online'] >0)
		{?>
			$("#a1").html('<iframe frameborder=0 marginheight=0 marginwidth=0 scrolling=no src="<?=$user['ather'];?><?php echo $_GET["url"]; ?>" width="100%" height="100%" allowfullscreen="true"></iframe>');
			$("#error").hide();
			$("#loading").hide();
			$("#a1").show();
		<?php
		}else{?>
    		$("#a1").html('解析失败');
    		$("#error").hide();
    		$("#loading").hide();
    		$("#a1").show();
		<?php }?>
	}
	},'json');




</script>
<?php
if(!empty($user['tongji']))
{
    echo "<div style=\"display:none\">";
    $tongji=explode(',',$user['tongji']);
    foreach($tongji as $value)
    {
        echo "<script type='text/javascript' src='$value'></script>";
    }
    echo "</div>";
}
?>
</body>
</html>
